#include "../Logs/cl_logs.hpp"
#include "bench.h"
namespace cl{
void sync_bench()
{
    std::unique_ptr<GlobalLoggerBuilder> builder(new GlobalLoggerBuilder());
    builder->buildLoggerName("sync_logger");
    builder->buildLoggerType(cl::Logger::Type::LOGGER_SYNC);
    builder->buildFormatter("%m%n");
    builder->buildSink<cl::FileSink>("../logs/sync.log"); 
    builder->build();
 
    bench("sync_logger", 5, 1000000, 100);
}
 
void async_bench()
{
    std::unique_ptr<GlobalLoggerBuilder> builder(new GlobalLoggerBuilder());
    builder->buildLoggerName("Async_logger");
    builder->buildLoggerType(cl::Logger::Type::LOGGER_ASYNC); 
    // builder->BuildEnableUsafeAsync(); // 排除实际落地时间造成的影响
    builder->buildFormatter("%m%n");
    builder->buildSink<cl::FileSink>("../logs/async.log");
    builder->build();
 
    bench("Async_logger", 5, 1000000, 100);
}
}

int main()
{
    cl::sync_bench();
    cl::async_bench();
}